<template>
  <a-modal title='历史售价查询' width='1080px'  :dialog-style="{ top: '10px' }" :visible='visible' :confirmLoading='loading' :footer='null' @cancel='handleCancel'>
    <f-table ref='table' rowKey='detailsId' :scroll='{x:800,y:180}' v-if='visible' @rowClick='drugClick' :columns='columns' :params='queryParam' :multiple='false' :showPagination='false' :api='api.bpd.getHistoryDrug'>

    </f-table>
  </a-modal>
</template>
<script>
import api from "../js/api"

export default {
  name: "SelectHistoryDrugsModal",
  props: {},
  data() {
    return {
      api: Object.assign(api, this.api),
      refs: this.$refs,
      loading: false,
      visible: false,
      selectedRowKeys: [],
      selectedRows: [],
      //列表初始化查询参数
      queryParam: {},
      drugSelectRow: {},
      // 表头
      columns: [
        {
          title: "商品名称",
          align: "center",
          width: "130px",
          ellipsis: true,
          dataIndex: "drugsName"
        },
        {
          title: "规格",
          align: "center",
          width: "150px",
          ellipsis: true,
          dataIndex: "drugsSpec"
        },
        {
          title: "销售日期",
          align: "center",
          width: "100px",
          dataIndex: "saleDate"
        },
        {
          title: "销售价格",
          align: "center",
          width: "100px",
          dataIndex: "salePrice"
        },
        {
          title: "销售数量",
          align: "center",
          width: "100px",
          dataIndex: "saleNum"
        },
        {
          title: "件容",
          align: "center",
          width: "50px",
          dataIndex: "drugJr"
        },
        {
          title: "单位",
          align: "center",
          width: "40px",
          dataIndex: "drugsUnit"
        },
        {
          title: "生产企业",
          align: "center",
          width: "120px",
          ellipsis: true,
          dataIndex: "producersName"
        },
        {
          title: "供货商",
          align: "center",
          width: "100px",
          ellipsis: true,
          dataIndex: "supplierName"
        }
      ]
    }
  },
  computed: {
   
  },
  methods: {
    open(drugNo,customCode) {
      this.queryParam.drugNo=drugNo;
      this.queryParam.customCode=customCode;
      this.visible = true
      this.selectedRowKeys = []
      this.selectedRows = []
    },
    close() {
      this.$emit("close")
      this.visible = false
    },
    drugClick(record, event) {
      let drugsId = record.drugsId
    },
    dblclick(record, event) {
      let canUseNum = record.canUseNum
      if (canUseNum <= 0) {
        this.$message.success("库存不足")
        return
      }
      this.$emit("drugsSelectChange", record, this.drugSelectRow)
      this.close()
    },
    handleCancel() {
      this.close()
    },
    onSelectChange(selectedRowKeys, selectedRows) {
      this.selectedRowKeys = selectedRowKeys
      this.selectedRows = selectedRows
    }
  },
  created() {
  },
  components: {}
}
</script>

<style scoped lang='less' rel='stylesheet/less'>

</style>
